//
//  SiteArrayController.m
//  iChangeChecker
//
//  Created by Lauri Koskela on 17.4.2011.
//  Copyright 2011 Lauri Koskela. All rights reserved.
//

#import "SiteArrayController.h"
#import "iChangeCheckerAppDelegate.h"
#import "PageTableView.h"

@implementation SiteArrayController
@synthesize appDelegate;

- (IBAction)add:(id)sender {
    [[appDelegate window] makeFirstResponder:nil]; 
    
    id obj = [self newObject];
    NSString *ID = [[NSProcessInfo processInfo] globallyUniqueString];
    [obj setValue:ID forKey:@"ID"];
    [self addObject:obj];
    PageTableView *table = appDelegate.siteTableView;
    [table editColumn:0 row:[self selectionIndex] withEvent:nil select:YES];
}

- (IBAction)remove:(id)sender {
    [[appDelegate window] makeFirstResponder:nil];
    
    [super removeObjectAtArrangedObjectIndex:[self selectionIndex]];
    [appDelegate.managedObjectContext save:NULL];
}
@end
